package com.brainardphotography.blog.web.admin;

import java.util.logging.Logger;

import com.brainardphotography.blog.BlogEntry;
import com.brainardphotography.blog.dao.BlogEntryDAO;
import com.google.inject.Inject;

public class BlogEntryForm extends AdminBrick {
	private static final long serialVersionUID = -2824211227129548640L;

	private static final Logger log = Logger.getLogger(BlogEntryForm.class.getName());
	
	@Inject
	private BlogEntryDAO blogEntryDAO;
	
	private BlogEntry entry = new BlogEntry();

	public BlogEntry getEntry() {
		return this.entry;
	}

	public void setEntry(BlogEntry entry) {
		log.info("Editing blog entry: " + entry.toString());
		this.entry = entry;
	}

	public void saveEntry() {
		log.info("Saving blog entry: " + entry.toString());
		blogEntryDAO.save(entry);
	}
}
